package com.yc.common.core.domain.entity;

import lombok.Builder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 用户对象 tb_sys_user
 */
@Builder
public class SysUser implements Serializable {

    @Serial
    private static final long serialVersionUID = -7948234430539396069L;

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 用户昵称
     */
    private String nickName;

    /**
     * 用户邮箱
     */
    private String email;

    /**
     * 用户密码
     */
    private String password;

    /**
     * 账号状态（0正常、1停用）
     */
    private String status;

    /**
     * 删除标志（0代表存在、1代表删除）
     */
    private String isDeleted;

    /**
     * 角色信息
     */
    private List<SysRole> roles;

    public SysUser() {
    }

    public SysUser(Long userId) {
        this.userId = userId;
    }

    // 全参构造器
    public SysUser(Long userId, String nickName, String email,
                   String password, String status, String isDeleted, List<SysRole> roles) {
        this.userId = userId;
        this.nickName = nickName;
        this.email = email;
        this.password = password;
        this.status = status;
        this.isDeleted = isDeleted;
        this.roles = roles;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(String isDeleted) {
        this.isDeleted = isDeleted;
    }

    public List<SysRole> getRoles() {
        return roles;
    }

    public void setRoles(List<SysRole> roles) {
        this.roles = roles;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
                .append("userId", getUserId())
                .append("nickName", getNickName())
                .append("email", getEmail())
                .append("password", getPassword())
                .append("status", getStatus())
                .append("isDeleted", getIsDeleted())
                .append("roles", getRoles())
                .toString();
    }
}
